<template>
  <el-date-picker
    v-model="date"
    type="date"
    placeholder="Pick a day"
    format="YYYY/MM/DD"
    :clearable="false"
    :editable="false"
    @change="changeValue"
    :disabled-date="disabledDate"
  />
</template>

<script lang="ts" setup>
import { resetSetItem } from '../MonitorSessionStorage';
const props = defineProps(['date']);
const date = ref('');
date.value = props.date;
const changeValue = (value: string) => {
  resetSetItem('newDate', JSON.stringify(value));
};

//设置不可选择时间
const disabledDate = (time: Date) => {
  var now = new Date();
  now.setHours(0, 0, 0, 0);
  return time.getTime() > now.getTime();
};
</script>

<style scoped lang="scss"></style>
